package site.icesky.springboot.log.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import site.icesky.springboot.log.controller.LogController;

/**
 * @ClassName: RedisService <br>
 * @Description: redis的日常操作 <br>
 * @Package: site.icesky.springredis.service <br>
 * @author: suitianmou <br>
 * @Date: 2020/5/20-16:46 <br>
 * @version: 1.0 <br>
 * @see <br>
 * @since (从产品的哪一个版本此类被添加进来 ( 可选))<br>
 * 修改历史: <br>
 * 修改时间             修改人           版本变更           修改说明<br>
 * -----------------------------------------------------<br>
 * <br>
 */
@Service
public class LogService {
    private static final Logger logger = LoggerFactory.getLogger(LogController.class);

    /* 使用resttemplate 远程调用另一个服务，查看zipkin的链路处理流程 */
    final RestTemplate restTemplate;

    @Autowired
    LogService(RestTemplateBuilder restTemplateBuilder) {
        this.restTemplate = restTemplateBuilder.build();
    }

    public String logTest(){
        logger.info("这是logService的处理，将要调用远程服务");
        RestTemplateBuilder restTemplateBuilder;
        return restTemplate.getForObject("http://localhost:9000/api", String.class);
    }

}
